package com.demo;

public class D2 {
    public static void main(String[] args) {
        System.out.println(contStr(
                "ab",
                "ababcabbabcab"
        ));
    }
    public static int contStr(String x,String y){
        int count = 0;
        int index = 0;
        while (true){
            int i = y.indexOf(x, index);
            if (i == -1)
                break;
            count++;
            index = i+1;
        }
        return count;
    }
}
